package com.pubinfo.passbook.common.model.constant;

public enum City {
  // 温州("市本级","洞头","乐清","永嘉","瑞安","平阳","苍南","文成","泰顺","龙港") ;
  Wenzhou("温州", Type.WenZhou.class),
  ShengGongSi("省公司", Type.ShengGongSi.class),
  TaiZhou("台州", Type.Taizhou.class);
  //PROVINCIAL_BRANCHES("省公司"),HANG_ZHOU("杭州"),NING_BO("宁波"),
  //,JIA_XING("嘉兴"),HU_ZHOU("湖州"),SHAO_SHING("绍兴"),JIN_HUA("金华"),QU_ZHOU("衢州"),LI_SHUI("丽水//"),TAI_ZHOU("台州"),ZHOU_SHAN("舟山"),TRANSPORT_BUREAU("传输局"),PUBINFO("信产");
  public String name;
  public Class<? extends Type> districtType;
  Type[] values;
  
  City(String name, Class<? extends Type> districtType) {
    this.name = name;
    this.districtType = districtType;
    this.values = districtType.getEnumConstants();
  }
  
  public static Class<? extends Type> get(String city) {
    for (City e : City.values()) {
      if (e.getName().equals(city)) {
        return e.getDistrict();
      }
      
    }
    return null;
  }
  
  public Type[] getValues() {
    return values;
  }
  
  public String getName() {
    return this.name;
  }
  
  public Class<? extends Type> getDistrict() {
    return this.districtType;
  }
  
  public interface Type {
    
    enum Taizhou implements Type {
      lin_hai("临海");
      private final String name;
      
      Taizhou(String name) {
        this.name = name;
      }
      
      @Override
      public String getName() {
        return this.name;
        
      }
      
      public static Taizhou get(String district) {
        for (Taizhou e : Taizhou.values()) {
          if (e.getName().equals(district)) {
            return e;
          }
        }
        return null;
      }
      
    }
    
    enum WenZhou implements Type {
      MUNICIPAL_LEVEL("市本级"), DONG_TOU("洞头"), YUE_QING("乐清"), YONG_JIA("永嘉"), RY_AN("瑞安"), PING_YANG("平阳"), CANG_NAN("苍南"), WEN_CHENG("文成"), TAI_SHUN("泰顺"), LONG_GANG("龙港");
      private final String name;
      
      WenZhou(String name) {
        this.name = name;
      }
      
      @Override
      public String getName() {
        return this.name;
    
      }
  
      public static WenZhou get(String district) {
        for (WenZhou e : WenZhou.values()) {
          if (e.getName().equals(district)) {
            return e;
          }
        }
        return null;
      }
  
    }
  
    enum ShengGongSi implements Type {
      BEN_BU("本部");
      private final String name;
    
      ShengGongSi(String name) {
        this.name = name;
      }
    
      @Override
      public String getName() {
        return this.name;
      
      }
    
      public static ShengGongSi get(String district) {
        for (ShengGongSi e : Type.ShengGongSi.values()) {
          if (e.getName().equals(district)) {
            return e;
          }
        }
        return null;
      }
    }
  
    String getName();
  }
}
